import { _decorator, Component, Label, Node, tween, Tween, UIOpacity } from 'cc';
import { GAME_TOP } from '../Data/GlobalData';
const { ccclass, property } = _decorator;

@ccclass('TopPromptText')
export class TopPromptText extends Component {

    //文字
    @property(Label)
    private Prompt: Label = null;

    //透明度
    @property(UIOpacity)
    private UIOpacity: UIOpacity = null;

    /**
     * 
     */
    public UpdatePrompt(_prompt: string) {
        this.Prompt.string = _prompt;

        this.UIOpacity.opacity = 0;

        Tween.stopAllByTarget(this.UIOpacity);
        tween(this.UIOpacity).to(0.2, { opacity: 255 }).delay(1).to(0.2, { opacity: 0 }).call(() => {
            app.topManager.HideTop(GAME_TOP.TopPromptText)
        }).start();
    }
}


